package com.pet.seller.controller;


import com.pet.seller.mapper.SellerMapper;
import com.pet.seller.model.Seller;
import com.pet.seller.util.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;


@RestController
public class RegisterController {
    @Autowired
    private SellerMapper sellerMapper;

    @RequestMapping(value="/doRegister",method = RequestMethod.POST)
    public String signin(HttpServletRequest request, Model model) {
        String email = request.getParameter("email");
        String password = request.getParameter("password");
        String passMd5 = Md5Util.MD5(password);
        Seller seller = new Seller();
        seller.setEmail(email);
        seller.setPassword(passMd5);
        sellerMapper.insertSelective(seller);
        return "OK";
    }

}